function right(parent) {
    if (!parent.offsetWidth) return;
    var width = scrollWidth(parent);
    parent.scrollBy(width, 0);
}

function left(parent) {
    if (!parent.offsetWidth) return;
    var width = scrollWidth(parent);
    parent.scrollBy(-width, 0);
}
/**
 * 获取位移的长度
 * @param {Element} parentView 父视图
 * @returns 返回位移距离
 */
function scrollWidth(parentView) {
    let width = parentView.children[0].offsetWidth;
    let gap = getComputedStyle(parentView)['gap'];
    gap = Number(gap.replace("px", ""));
    if (gap) {
        width += gap;
    }
    return width;
}
export default {
    right, left
}